package  com.example.mobile2121606097wjc0505.ui.login;

import android.app.Activity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;

import android.app.AlertDialog;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

import com.example.mobile2121606097wjc0505.R;
import com.example.mobile2121606097wjc0505.ui.login.LoginViewModel;
import com.example.mobile2121606097wjc0505.ui.login.LoginViewModelFactory;
import com.example.mobile2121606097wjc0505.databinding.ActivityRegisterBinding;

public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {
       private TextView tvRsgisterTitle;
       private EditText edtTxtRegisterUserName;
       private EditText edtTxtRegisterPassword;
       private Button btnRegisterLogin;
       private Button btnRegisterRegister;

       @Override
       protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_register);
              initView();
       }
       @Override
       public void onClick(View v){
              switch(v.getId()){
                     case R.id.btnRegisterLogin:
                            if (edtTxtRegisterUserName.getText().toString().equals("admin")&
                            edtTxtRegisterPassword.getText().toString().equals("123456"))
                                   new AlertDialog.Builder(this)
                                           .setTitle("登录信息")
                                           .setMessage("登录成功")
                                           .setPositiveButton("确定",null)
                                           .create()
                                           .show();
                            break;
                     case R.id.btnRegisterRegister:
                            break;
              }
       }
       private void initView() {
              tvRsgisterTitle = (TextView) findViewById(R.id.tvRegisterTitle);
              edtTxtRegisterUserName=(EditText) findViewById(R.id.edtTxtRegisterUserName);
              edtTxtRegisterPassword=(EditText) findViewById(R.id.edtTxtRegisterPassword);
              btnRegisterLogin=(Button) findViewById(R.id.btnRegisterLogin);
              btnRegisterRegister=(Button) findViewById(R.id.btnRegisterRegister);
              btnRegisterLogin.setOnClickListener(this);
              btnRegisterRegister.setOnClickListener(this);
       }
}